package com.jwds.digital.bios.business.api.controller.dispatch;

import com.jwds.digital.bios.business.core.infrastructure.dto.dispatch.DispatchReceivingMaterialsReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.BasicStockBinReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.vo.dispatch.DispatchReceivingMaterialsRespVO;
import com.jwds.digital.bios.business.core.infrastructure.vo.feign.BasicStockBinRespVO;
import com.jwds.digital.bios.business.core.infrastructure.vo.feign.FlowBasicRespVO;
import com.jwds.digital.bios.business.service.service.dispatch.IDispatchReceivingMaterialsService;
import com.jwds.tdc.framework.application.lib.BaseResponse;
import com.jwds.tdc.framework.application.lib.page.PageRequest;
import com.jwds.tdc.framework.application.lib.page.PageResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.IOException;
import java.util.List;

/**
 * 料场受料调度 前端控制器
 *
 * @author 林柏云
 * @date 2024-10-24
 */
@Slf4j
@Api(tags = "料场受料调度")
@RestController
@RequestMapping("/dispatch/receiving/materials")
public class DispatchReceivingMaterialsController {

    @Resource
    private IDispatchReceivingMaterialsService service;



    @PostMapping("/list")
    @ApiOperation(value = "分页查询")
    public BaseResponse<PageResponse<DispatchReceivingMaterialsRespVO>> page( @RequestBody PageRequest<DispatchReceivingMaterialsReqDTO> pageRequest) {
        PageResponse<DispatchReceivingMaterialsRespVO> respVoPage = service.page(pageRequest);
        return BaseResponse.success(respVoPage);
    }

    @PostMapping("/all")
    @ApiOperation(value = "查询全部数据")
    public BaseResponse<List<DispatchReceivingMaterialsRespVO>> list() {
        List<DispatchReceivingMaterialsRespVO> respVoList = service.findAll();
        return BaseResponse.success(respVoList);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除对象")
    public BaseResponse<?> delete(@PathVariable("id") Long id) {
        service.delete(id);
        return BaseResponse.success();
    }

    @GetMapping("/DropDownBox/{destPointion}")
    @ApiOperation(value = "下拉框终点")
    public BaseResponse<List<String>> DropDownBox(@PathVariable String destPointion) {
        List<String> respVoList = service.DropDownBox(destPointion);
        return BaseResponse.success(respVoList);
    }

    @GetMapping("/export")
    @ApiOperation(value = "导出")
    public BaseResponse<?> export(){
        service.export();
        return BaseResponse.success();
    }

    @GetMapping("/process/{id}")
    @ApiOperation("生成流程")
    public BaseResponse<List<FlowBasicRespVO>> Process(@PathVariable("id") Long id){
        List<FlowBasicRespVO> respVoList = service.Process(id);
        return BaseResponse.success(respVoList);
    }




}
